package com.study.IoC;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Created by 汪贵春 on 2017/2/22.
 */
@Component
public class ScrewDriver {

    @Autowired
    private Header header;
    public void setHeader(Header header){
        this.header = header;
    }


    public void useScrew(){
        System.out.println("use " + header.getInfo());
    }

    @PostConstruct
    public void init(){
        System.out.println("init screwDriver");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("destroy screwDriver");
    }
}
